@extends('admin.base.index')

@section('content')

                    <div class="block-area" id="defaultStyle">
                    <h3 class="block-title">订单信息管理</h3>
                      <!--删除-->
                    <form action="/admin/order" method="post" name="myform">
                        <input type="hidden" name="_token" value="{{csrf_token()}}">
                        <input type="hidden" name="_method" value="DELETE">
                    </form>
                        <!--分页-->
                    <form action='/admin/order/order' method='get'>
                        <div class='media-body'>
                            商品名：<input type='text' class='form-control m-b-5' name='gname'>
                        </div>

                        <input type='submit' class='btn' value='搜索'>
                    </form>

                    </div>
                <div class="block-area" id="defaultStyle">
                    <h3 class="block-title">Default Style</h3>
                    <table class="table tile">
                        <thead>
                            <tr>
                                <th>订单号</th>
                                <th>订单状态</th>
                                <th>商品名字</th>
                                <th>商品单价</th>
                                <th>商品数量</th>
                                <th>商品总价</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach($list as $v)
                            <tr>
                                <td>{{$v->id}}</td>
                                <td>
                                @if($v->state==1)未付款
                                @elseif($v->state==2)已付款,未发货
                                @elseif($v->state==3)已发货,未送达
                                @elseif($v->state==4)交易成功
                                @endif
                                </td>
                                <td>{{$v->gname}}</td>
                                <td>{{$v->gprice}}</td>
                                <td>{{$v->number}}</td>
                                <td>{{$v->total}}</td>
                                <td>
                                    <a href="javascript:doDel({{$v->id}})" class="btn">删除</a>
                                    <a href="/admin/order/order/{{$v->id}}/edit" class="btn">修改</a>
                                </td>
                            </tr>
                            @endforeach
                        </tbody>
                    </table>
                    <!--显示分页，并带上附加搜索参数-->
                {{$list->appends($where)->links()}}
                 <script type="text/javascript">
                 function doDel(id)
                 {
                    if(confirm("确定要删除吗？")){
                        var form = document.myform;
                        form.action = "order/"+id;
                        form.submit();
                    }
                 }
                 </script>
                </div>
 @stop
